<!--
 * @Author: luoqi
 * @Date: 2022-03-10 16:10:33
 * @LastEditors: luoqi
 * @LastEditTime: 2022-04-24 14:46:26
 * @Description: 
-->
<template>
  <div class="box">
    <div class="item">
      <div style="margin: 10px 0"><el-checkbox  class="checkbox" @change="changeCheck" v-model="checked">隐私用户（不能查看所有收藏详细信息）</el-checkbox></div>
      
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      checked:this.$getStorage("userinfo").status==0?true:false,
    };
  },
  methods: {
    changeCheck(value) {
      console.log(value)
      this.$axios({
        method: "post",
        url: "/user/update",
        data: this.$qs.stringify({
          status:value?0:1,
          id: this.$getStorage("userinfo").id,
        }),
      }).then((res) => {
        console.log(res);
        if (res.code != "200") {
          this.$message.error(res.msg);
          
        } else {
          this.$message({
            message: "更改成功",
            type: "success",
          });
          // let old=this.$getStorage('userinfo')
          // console.log({...old,...res.data})
          this.$setStorage('userinfo',res.data)
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.box {
  width: 100%;
  background-color: #f2f7fb;
  // overflow: hidden;

  .item {
    background-color: white;
    margin: 35px 0;
    padding: 30px 50px;
    box-sizing: border-box;
    box-shadow: 0 0 8px 5px rgba(228, 228, 228, 0.5);
    border-radius: 10px;
    & > div {
      margin: 30px 0;
      .left {
        text-align: left;
      }
      .img-tip {
        color: #999;
        margin-bottom: 20px;
        text-align: left;
      }
      .checkbox {
        width: 100%;
        font-size: 14px !important;
        margin: 20px;
        text-align: left;
      }
    }
  }
}
::v-deep .el-checkbox__label {
  font-size: 16px !important;
}
::v-dee .el-checkbox__inner {
  width: 20px !important;
  height: 20px !important;
}
</style>